package com.youlai.boot.bmp.service.impl;

import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.youlai.boot.bmp.mapper.BizProcessCategoryBindingMapper;
import com.youlai.boot.bmp.service.BizProcessCategoryBindingService;
import com.youlai.boot.bmp.model.entity.BizProcessCategoryBinding;
import java.util.Arrays;
import java.util.List;

import cn.hutool.core.lang.Assert;
import cn.hutool.core.util.StrUtil;

/**
 * 工作流和分类绑定服务实现类
 *
 * @author rabit
 * @since 2025-11-05 09:13
 */
@Service
@RequiredArgsConstructor
public class BizProcessCategoryBindingServiceImpl extends ServiceImpl<BizProcessCategoryBindingMapper, BizProcessCategoryBinding> implements BizProcessCategoryBindingService {

    /**
     * 删除工作流和分类绑定
     *
     * @param ids 工作流和分类绑定ID，多个以英文逗号(,)分割
     * @return 是否删除成功
     */
    @Override
    public boolean deleteBizProcessCategoryBindings(String ids) {
        Assert.isTrue(StringUtils.isNotBlank(ids), "删除的工作流和分类绑定数据为空");
        // 逻辑删除
        List<Long> idList = Arrays.stream(ids.split(","))
                .map(Long::parseLong)
                .toList();
        return removeByIds(idList);
    }

}
